<style type="text/css">
ul.iStu12 {
	list-style: none;
	margin: 0 auto;
	position: relative;
	padding: 0 42px 25px 42px;
	width: 0;
}
ul.iStu12 li.prev {
	position: absolute;
	width: 42px;
	height: 123px;
	left: 0;
	z-index: 100;
	cursor: pointer;
	background-image: url(images/left.png);
}
body {
	background-image: url(images/bg1.jpg);
	background-repeat: repeat-y;
	font-size: 12px;
	background-position: center center;
	letter-spacing: 0.1em;
	line-height: 15px;
	width: 690px;
	background-color: #F9EFE3;
	margin-right: auto;
	margin-left: auto;
}
ul.iStu12 li.next {
	position: absolute;
	width: 42px;
	height: 123px;
	right: 0;
	z-index: 100;
	cursor: pointer;
	background-image: url(images/right2.png);
	top: 2px;
}
ul.iStu12 li.images {
	position: absolute;
	left: 42px;
	top: 0;
	overflow: hidden;
	z-index: 50;
	padding-bottom: 10px;
}
ul.iStu12 li.images div.slide {
	position: absolute;
	left: 0;
	top: 0;
}
ul.iStu12 li.images img {
	display: block;
	float: left;
}
ul.iStu12 li.caption {
	position: absolute;
	bottom: 0;
	left: 42px;
	color: #000;
	font-family: arial, sans-serif;
	font-size: 16px;
	line-height: 25px;
	font-weight: bold;
	margin-top: 10px;
	display: block;
}
#fast_menu {
	width: 660px;
	border: 1px none #999;
	padding: 10px;
	text-align: center;
	position: relative;
	margin-right: auto;
	margin-left: auto;
}
.red {
	color: #F00;
	font-size: 16px;
	font-weight: bold;
	font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}
#fast_menu #text {
	text-align: center;
	width: 100%;
	background-color: #CCC;
	margin:20px auto;
}
</style>
<div id="fast_menu">
	<ul style="list-style:none;">
		<li class="images">
			<div class="slide">
				<embed src="<?=$row->movie_url?>" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>
			</div>
		</li>
		<li class="caption"></li>
	</ul>
	<span id="waitmsg">您將於 </span><span class="red" id="time_<?=$row->serial?>"></span><span id="waitmsg2"> 秒後取得通關密語</span>
	<div id="text" style="display:none;">
		<form id="form1" name="form1" method="post" action="">
			請輸入通關密語：
			<label for="textfield"></label>
			<input type="text" name="code" id="code" />
			&nbsp;
			<input type="submit" name="button" id="button" value="送出" />
		</form>
	</div>
</div>
<script>
$(document).ready(function() {
	onTimer('<?=$row->serial?>',<?=$row->code_time?>,changeShowTime,onTimeEnd);
});
 
// 该函数用于显示倒计时
function changeShowTime(id,time) {
    /* 该函数内编写显示倒计时的语句 */  
    $(id).html(time);    
}
//倒計時結束的時候執行的函數
function onTimeEnd(id){
	$.post('<?php echo CHtml::normalizeUrl(array('/activity/getActivityCode'));?>',{'serial':id}, function (data) {
		var ret = $.parseJSON(data);
		if (ret != null && ret.success != null) {
			if(ret.success){
				$("#waitmsg")[0].innerHTML='恭喜您獲得通關密語！通關密語為：';
				$("#waitmsg2")[0].innerHTML='';
				$("#time_"+id)[0].innerHTML=ret.msg;
				$("#text").show()
			}else{
				$("#waitmsg")[0].innerHTML='錯誤提示';
				$("#waitmsg2")[0].innerHTML='';
				$("#time_"+id)[0].innerHTML=ret.msg;
			}					
		}
	});	
}
</script>